package com.example.springblog.service;

import com.example.springblog.mapper.BlogMapper;
import com.example.springblog.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    private BlogMapper blogMapper;


    public List<BlogInfo> getBlogList() {
        return blogMapper.selectBlog();
    }

    public BlogInfo getBlogDetail(Integer id) {
        return blogMapper.selectBlogByID(id);
    }

    public void insertBlog(BlogInfo blogInfo) {
        blogMapper.addBlog(blogInfo);
    }

    public void updateBlog(BlogInfo blogInfo) {
        blogMapper.updateBlogByID(blogInfo);
    }
}
